define(function(require){
    var angular = require("angularjs");
    var appServices = require("./home.services");
    var appControllers = require("./home.controllers");
    var appDirectives = require("./home.directives");
    var appFilters = require("./home.filters");

    var app = angular.module('bodyApp', [])
    
    .config(['$routeProvider', function($routeProvider){
        $routeProvider
        .when('/home',{
            template: 'this is home template'
        })
        .when('/other',{
            templateUrl: 'templates/self_script.html',
            controller: 'otherCtl'
        })
        .when('/user',{
            templateUrl: 'templates/self_script.html',
            controller: 'userCtl'
        })
        .otherwise({
            redirectTo: '/home'
        });
    }])

    .provider('dummyData', appServices.dummyData)

    .factory('ProductService', appServices.productService)
    .factory('UserService', ['$q', 'dummyData', appServices.userService])

    .controller('bodyCtl', ['$scope', 'ProductService', '$http', appControllers.homeCtl])
    .controller('otherCtl', ['$scope', appControllers.otherCtl])
    .controller('userCtl', ['$scope', 'UserService', appControllers.userCtl])

    .directive('ngHeader', appDirectives.ngHeader)

    .filter('displayData', appFilters.displayData);

    return {
        init: function() {
            angular.bootstrap(document.body, ['bodyApp'])
        }
    };
});